import { ybuser } from './ybuser.js'
const ybapi = {
	Login_Userlogin:function(account,passwd,success,error){
		ybuser.httpget('App.Login.Userlogin',{account,passwd},function(data){
			ybuser.setToken(data);
			success(data);
		},error)
	},
	User_Getmyinfo:function(success){
		ybuser.httpget("App.User.Getmyinfo",{},function(data){
			success(data);
		},function(e){
			console.log(e);
		})
	},
	Devices_GetProducts:function(page,perpage,success,error){
		ybuser.httpget('App.Devices.GetProducts',{page,perpage},success,error);
	},
	Devices_GetProductInfo:function(productid,success,error){
		ybuser.httpget('App.Devices.GetProductInfo',{productid},success,error);
	},	
	
	Devices_GetDevices:function(productid,page,perpage,success,error){
		ybuser.httpget('App.Devices.GetDevices',{productid,page,perpage},success,error);
	},	
	Devices_GetDeviceInfo:function(devid,success,error){
		ybuser.httpget('App.Devices.GetDeviceInfo',{devid},success,error);
	},		
	
	Devices_GetRTData:function(devid,devxlh,orderby,fields,page,perpage,success,error){
		ybuser.httpget('App.Devices.GetRTData',{devid,devxlh,orderby,fields,page,perpage},success,error);
	},		
	Devices_GetRTDataByid:function(id,devxlh,success,error){
		ybuser.httpget('App.Devices.GetRTDataByid',{id,devxlh},success,error);
	},	
	Backuser_UpdateData:function(id,key,value,success,error){
		ybuser.httpget('App.Backuser.UpdateData',{id: id,data: {[key]: value}},success,error);	
	},
	Backiotdevice_FastList:function(page,pageSize,productid,success,error){
		ybuser.httpget('App.Backiotdevice.FastList',{page,pageSize,searchParams: {"productid":productid}},success,error);
	},
	Backiotdatadb_FastList:function(page,pageSize,devid,success,error){
		ybuser.httpget('App.Backiotdatadb.FastList',{page,pageSize,searchParams: {"devid":devid}},success,error);
	},
	Backiotdatadb_Gettotal:function(devid,success,error){
		ybuser.httpget('App.Backiotdatadb.Gettotal',{searchParams: {"devid":devid}},success,error);
	},
	Backiotdatawgbc_FastList:function(page,pageSize,devid,success,error){
		ybuser.httpget('App.Backiotdatawgbc.FastList',{page,pageSize,searchParams: {"devid":devid}},success,error);
	},
	Backiotdatawgbc_Gettotal:function(devid,success,error){
		ybuser.httpget('App.Backiotdatawgbc.Gettotal',{searchParams: {"devid":devid}},success,error);
	},
	Backiotdevice_Gettotal:function(productid,success,error){
		ybuser.httpget('App.Backiotdevice.Gettotal',{searchParams: {"productid":productid}},success,error);
	},
	Backiotdatadb_FastList_id:function(page,pageSize,id,success,error){
		ybuser.httpget('App.Backiotdatadb.FastList',{page,pageSize,searchParams: {"id":id}},success,error);
	},
	Backiotdatawgbc_FastList_id:function(page,pageSize,id,success,error){
		ybuser.httpget('App.Backiotdatawgbc.FastList',{page,pageSize,searchParams: {"id":id}},success,error);
	},
	Backuser_GetData:function(id,success,error){
		ybuser.httpget('App.Backuser.GetData',{id},success,error);
	},
	Devices_GetMyProducts:function(success,error){
		ybuser.httpget('App.Devices.GetMyProducts',{},success,error);
	},
	Backiottjjn_FastList:function(page,pageSize,devid,success,error){
		ybuser.httpget('App.Backiottjjn.FastList',{page,pageSize,searchParams: {"devid":devid}},success,error);
	},
	Devices_GetJNInfoByid:function(id,success,error){
		ybuser.httpget('App.Devices.GetJNInfoByid',{id},success,error);
	},
	Backiottjjn_Gettotal:function(devid,success,error){
		ybuser.httpget('App.Backiottjjn.Gettotal',{searchParams: {"devid":devid}},success,error);
	}
}

export { ybapi }